home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
rexx
/
golded
/
startdviprint.ged
< prev
next >
Wrap
Text File
|
1995-03-15
|
3KB
|
117 lines
/* Look at the command at the end of the script an change it accordingly to your
TeX setup
Done by R. Laederach
*/
/* $VER: 0.9, ©1993 Dietmar Eilert. Empty GoldED macro */
OPTIONS RESULTS /* enable return codes */
if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
address 'GOLDED.1'
'LOCK CURRENT' /* lock GUI, gain access */
OPTIONS FAILAT 6 /* ignore warnings */
SIGNAL ON SYNTAX /* ensure clean exit */
/*** Look if DVIprint is already busy ***/
IF SHOW('P','dviprint') THEN DO
'REQUEST BODY="DVIprint is already running, please wait"'
UNLOCK
EXIT
END
/*** Look if the user forgot to state which printer to use ***/
noprinter = mygetenv("DVIPRINT")
PARSE UPPER VAR noprinter . 'PRINTER' drucker .
'request body='drucker
IF noprinter=="" THEN DO
'REQUEST OLD="printer=" BODY="Use which printer and draft ?" STRING VAR PRINTER'
/* I hope you stated something reasonable */
CALL mysetenv("DVIPRINT",'"'printer'"') /* Look at that tricky construction !! */
END
CALL SETCLIP("pages")
'QUERY DOC'
filename=RESULT
basename = (left(filename, LENGTH(filename)-4))
extension = translate(right(filename, 4) , xrange('a','z'), xrange('A','Z'))
/*** is there a .dvi file ? ***/
IF ~EXISTS(basename||".dvi") THEN DO
'REQUEST BODY="The corresponding .dvi file does not exist|Use Start_TeX to generate one."'
UNLOCK
EXIT 5
END
/*** I want to know if the customer wants to print the whole text ***/
'REQUEST BODY="Print all pages ?" BUTTON="_Yep|_Nope"'
if (RESULT = 0) THEN DO
OPTIONS RESULTS
'REQUEST LONG BODY="Print from which page ?" MIN=0 MAX=10000 VAR PAGEFROM'
IF pagefrom='' THEN DO
'REQUEST BODY="Enter a number!"'
UNLOCK
EXIT
END
'REQUEST LONG OLD="" BODY="Print TO which page ?" MIN=0 MAX=1000 VAR PAGETO'
IF pageto='' THEN DO
'REQUEST BODY="Enter a number!"'
UNLOCK
EXIT
END
'REQUEST STRING BODY="Print every (<RET>), ODD or EVEN pages?" VAR WHATPAGE'
IF whatpage = "" THEN
CALL SETCLIP("pages","FROM" pagefrom" TO "pageto" ")
else
CALL SETCLIP("pages","FROM" pagefrom" TO "pageto whatpage" ")
END
/* now lets start the command given by the user and unlock GoldED */
ADDRESS COMMAND "run >nil: <nil: tex:bin/DVIPRINT -l -p -r "||GETCLIP("pages")||basename
'UNLOCK' /* VERY important: unlock GUI */
EXIT
SYNTAX:
SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
'UNLOCK'
EXIT
mygetenv: procedure /* when will ARexx supply GetEnv/SetEnv ? */
PARSE ARG name /* Thanks to Georg ! */
IF open(TEMPFILE,"ENV:"||name,'r') THEN DO
gives = readln(TEMPFILE)
CALL close TEMPFILE
END
ELSE gives = ""
RETURN gives
mysetenv: procedure
PARSE ARG name,content
ADDRESS COMMAND "SetEnv" name content
RETURN
END